<?php
$id				= gpc_getIntPost("id",$id);
$parentId       = gpc_getIntPost('ParentId');
$Status			= gpc_getIntPost("Status");
$Title			= gpc_getStringPost("Title");
$ImgIntro       = gpc_getStringPost("ImgIntro");
$Message    	= gpc_getStringPost("Message");

$TopBottomOrder	= gpc_getIntPost("TopBottomOrder",-1);
$order 			= gpc_getIntPost("Order",-1);
$order          = GetOrderForInsert($TopBottomOrder,$order,$parentId,"tblnewsletter_content");


$Message        = replace_pathlocal($Message);

if($act=='insertcontent')
{
    $sql_insert="insert into tblnewsletter_content(iParentId,cName,cImage,cIntro,
                iStatus,cLanguage,iOrder) 
                values('$parentId','$Title','$ImgIntro','$Message',
                '$Status','$language','$order')";
	$dbsql->query($sql_insert);
    
    page_transfer("Add newsletter content Success",'?module='.$module.'&opt=content&id='.$parentId);
}
else if($id>0)
{
    $sql_update = "update tblnewsletter_content set ";
    $sql_update.= " cName           = '$Title',";
    $sql_update.= " cImage          = '$ImgIntro',";
    $sql_update.= " cIntro          = '$Message',";
    $sql_update.= " iOrder          = '$order',";
    $sql_update.= " iStatus         = '$Status'";
    $sql_update.= " where iId       = '$id'";
    $dbsql->query($sql_update);
    
    page_transfer("Update newsletter content Success",'?module='.$module.'&opt=content&id='.$parentId);
}
exit;
?>